<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/public/common.jspf" %>
<html>
<head>
    <title>算法上传</title>

    <script type="text/javascript"
            src="${pageContext.request.contextPath}/scripts/jquery_validate/jquery.validate.min.js"></script>
    <script>
        $(document).ready(function () {
            $('input[type=file]').bootstrapFileInput();
            $('form').validate({
                rules: {
                    title: {
                        required: true,
                        maxlength: 255
                    },
                    description: {
                        required: true,
                        minlength: 6,
                        maxlength: 65535
                    }
                },
                messages: {
                    title: {
                        required: '标题不可为空',
                        maxlength: '标题长度不超过255字符'
                    },
                    description: {
                        required: '描述不可为空',
                        minlength: '描述长度在6-65535字符之间',
                        maxlength: '描述长度在6-65535字符之间'
                    }
                }
            });
        });
    </script>
</head>
<body>

<%--content--%>
<div class="col-sm-9">
    <div class="row">
        <div class="col-lg-12">
            <div class="page-header">
                <h1>算法上传</h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default bootstrap-admin-no-table-panel">
                <div class="panel-heading">
                    <div class="text-muted bootstrap-admin-box-title">算法上传</div>
                </div>
                <div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
                    <s:form method="POST" cssClass="form-horizontal" action="article_add" enctype="multipart/form-data"
                            id="addform">
                        <fieldset>
                            <legend>算法详情</legend>
                            <div class="form-group">
                                <label class="col-lg-2 control-label" for="title">标题 </label>

                                <div class="col-lg-10">
                                    <s:textfield name="title" cssClass="form-control"></s:textfield>
                                    <s:fielderror fieldName="title"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">算法图片</label>

                                <div class="col-lg-10">
                                    <s:file name="imageFile" title="请选择文件"></s:file>
                                    <s:fielderror fieldName="imageFile"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">算法文件</label>

                                <div class="col-lg-10">
                                    <s:file name="attachmentFile" title="请选择文件"></s:file>
                                    <s:fielderror fieldName="attachmentFile"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label" for="description">算法描述</label>

                                <div class="col-lg-10">
                                    <s:textarea name="description" cssClass="form-control" placeholder="输入描述..."
                                                rows="6"></s:textarea>
                                    <s:fielderror fieldName="description"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-8 col-xs-offset-2">
                                    <button type="submit" class="btn btn-primary">保存</button>
                                    <a type="reset" class="btn btn-default" href="index.html">取消并返回首页</a>
                                </div>
                            </div>
                        </fieldset>
                    </s:form>
                </div>
            </div>
        </div>
    </div>

</div>

<%--end content--%>
</body>
</html>
